<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;

class Admin extends Authenticatable
{
    protected $fillable = [
    	'username', 
    	'password',
    	'last_login_ip',
    	'last_longin_time',
    ];

    protected $appends = [
    	'name'
    ];

    public function setPasswordAttribute($v) {
    	$this->attributes['password'] = bcrypt($v);
    }

    public function getNameAttribute() {
    	return $this->username;
    }
}
